package com.itheima;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class Demo02 {
    public static void main(String[] args) {
    String s = "2020-6-13 13:14:15";
    LocalDateTime de = LocalDateTime.now();
    //moshi
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        //格式化
        String str =dateTimeFormatter.format(de);
        System.out.println(de);
        par();



    }
    private static void par() {
        String s = "2020-06-13 13:14:15";
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");

        LocalDateTime parse = LocalDateTime.parse(s, dateTimeFormatter);
        System.out.println(parse);



    }
}
